//
//  GWCustomTextField.m
//  百思不得姐
//
//  Created by qianfeng on 16/3/3.
//  Copyright © 2016年 高炜. All rights reserved.
//

#import "GWCustomTextField.h"
#import <objc/runtime.h>
static NSString *placeholderColor =@"_placeholderLabel.textColor";
@implementation GWCustomTextField

//+(void)initialize
//{
//    unsigned count =0;
//   Ivar *ivar = class_copyIvarList([UITextField class], &count);
//    
//    for (int i=0; i<count; i++) {
//        NSLog(@"%s",ivar_getName(*ivar++));
//    }
//    
//}
-(void)awakeFromNib
{
    [self resignFirstResponder];
    self.tintColor =self.textColor;
}
-(BOOL)becomeFirstResponder
{
    [self setValue:self.textColor forKeyPath:placeholderColor];
    return [super becomeFirstResponder];
}
-(BOOL)resignFirstResponder
{
    [self setValue:[UIColor grayColor] forKeyPath:placeholderColor];
    return [super resignFirstResponder];
}

@end
